define(function () {

    var self,userInfos;
    var yspj = app.Module.extend({

        init: function () {
            self = this;
            self.productData = [];
            self.mData = {
                tabType: ['1', '2',''],
                productList: {}
            };
            self.searchData = {
                keyword: ''
            };
            self.list = [];
            self._super({
                _tag: 'p_fwpj', // key, 对象放进pageModule
                _sliderId: 'slider', // tabs
                _refreshAutoInit: true, //自动加载刷新控件
                _readyBefore:function () {
                    userInfos = app.userInfos;

                }
            }, win);

            mui.ready(function () {

                Vue.component('fwpj-listitem', {
                    template: app.getByid(doc, 'item-template'),
                    props: {
                        model: Array
                    },
                    methods: {
                        open: function (item) {
                            app.openPage({
                                src: "fwpj/fwpj-info.html",
                                argsKey: 'fwpj-info',
                                args: {
                                    item: item,
                                    cb: function () {
                                        self._refresh();
                                    }
                                }
                            });
                        },
                        jindu: function (value) {
                            if (value == 1) {
                                return '发起';
                            } else if (value == 2) {
                                return '受理';
                            } else if (value == 3) {
                                return '派工';
                            } else if (value == 4) {
                                return '报工';
                            } else if (value == 5) {
                                return '评价';
                            } else if (value == 6) {
                                return '回访结案';
                            }
                        }
                    }
                });

            });
        },
        _search:function(d){
            self.searchData.keyword = d.keyword.trim();
            self._refresh();
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scroll1', 'scroll2','scroll'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: 'api/wx/fwpj/getServiceOrderListData',
                xdata: {
                    page:goods.page+1,
                    limit: goods.limit,
                    MMRD020: goods.type.replaceAll('scroll',''),
                    GWAK030:userInfos.sysUser.MOBILE,
                    keyword: self.searchData.keyword,//输入的查询条件
                    GWAA007:userInfos.user.GWAA007 //需判断是否为内部员工还是外部员工
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        goods.data.pushArray(data.data, goods.page == 0);
                        _super({
                            obj: goods,
                            dataLen: data.data.length,
                            nodata: self._refreshIndex == 0 ? '无未评价服务单...' : (self._refreshIndex == 1 ? '无已评价服务单...' : '无服务单...')
                        });
                    }
                }
            });

        },
        _lazy: function () {
            this._super();
        }
    });

    return new yspj();

});